package com.knife.database.backup.job;

import com.knife.database.backup.KnifeDbBackUp;
import com.knife.scheduler.infra.KnifeJobMarker;
import com.knife.scheduler.infra.annotations.KnifeJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

/**
 * 备份数据库任务
 *
 * @author： 76875
 * @date： 2022/4/2 星期六 14:33
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@KnifeJob(code = "db_backup")
public class KnifeDbBackupJob implements KnifeJobMarker {
    @Autowired
    private KnifeDbBackUp knifeDbBackUp;

    public static final Logger LOGGER = LoggerFactory.getLogger(KnifeDbBackupJob.class);

    @Override
    public void schedulerTask(Map<String, String> map) {
        LOGGER.info(Thread.currentThread().getName() + "执行备份开始");
        knifeDbBackUp.backUp();
        LOGGER.info(Thread.currentThread().getName() + "执行备份完成");
    }
}
